perm filename EMAIN6.2[EAL,HE]1 blob
sn#676508 filedate 1982-09-27 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 {$NOMAIN Editor: part of the main routine }
C00006 00003 procedure eDo2Cmd (ch: ascii iCh: integer var okp: boolean
C00010 ENDMK
C⊗;
{$NOMAIN Editor: part of the main routine }
%include emain.hdr;
{ Externally defined routines from elsewhere: }
(* From CALLER *)
procedure emAddStmnt(firstTime: boolean; which: integer); external;
procedure em6EditStmnt; external;
(* From EAUX1A *)
function getAChar: ascii; external;
(* From EAUX3A *)
procedure saveOutermostEnv; external;
function atStmnt: boolean; external;
(* From EAUX3B *)
procedure setBpt(st: statementp); external;
procedure clrBpt(st: statementp); external;
procedure clrAllBpts; external;
procedure setTBpt(st: statementp); external;
procedure stepStmnt(bpttype: integer); external;
(* From EDEBUG *)
procedure runStmnt(which: integer); external;
procedure executeStmnt(st: statementp; which: integer); external;
(* From PP *)
procedure ppLine; external;
procedure ppOutNow; external;
procedure ppChar(ch: ascii); external;
procedure pp5(ch: c5str; length: integer); external;
procedure pp10(ch: cstring; length: integer); external;
procedure pp10L(ch: cstring; length: integer); external;
procedure pp20(ch: c20str; length: integer); external;
procedure pp20L(ch: c20str; length: integer); external;
procedure ppInt(i: integer); external;
(* From DISP *)
procedure showCursor(line,col: integer); external;
procedure em6Get; external;
procedure em6Get; begin end;
procedure eDo2Cmd (ch: ascii; iCh: integer; var okp: boolean;
arg: integer); external;
procedure eDo2Cmd;
var b: boolean; i: integer;
begin
if iCh < 40B then ch := chr(iCh + 100B); (* Convert to a real char *)
case ch of
'I',
' ': begin
b := (ch = ' ');
if b then
with cursorStack[cursor] do
if stmntp then b := st↑.stype <> emptytype;
if b then em6EditStmnt
else
begin
with cursorStack[cursor] do
if stmntp then
if (st↑.stype <> emptytype) and (st↑.stype <> endtype) and
(st↑.stype <> coendtype) then
begin
b := cline <> cursorLine; (* 2nd line of AFFIX, ELSE, after label *)
if not b then
with cursorStack[cursor-1] do
if stmntp then b := st↑.stype <> blocktype
else b := nd↑.ntype = procdefnode;
end;
if not b then emAddStmnt(true,6)
else begin pp20L(' Can''t insert here ',18); ppLine end;
end;
showCursor(cursorLine-topDline-firstDline+2,1);
end;
'!': begin (* abbreviated debugger commands *)
ch := getAChar;
iCh := ord(ch);
if (140B < iCh) and (iCh < 173B) then ch := chr(iCh - 40B);
ppChar(ch); ppLine; (* echo it *)
case ch of
'B': begin
if arg = 0 then clrAllBpts
else if atStmnt then
with cursorStack[cursor] do
if arg > 0 then setBpt(st) else clrBpt(st);
end;
'S': begin stepStmnt(1); runStmnt(6); end;
'A': begin stepStmnt(2); runStmnt(6); end;
'N': begin stepStmnt(3); runStmnt(6); end;
'G': begin stepStmnt(4); runStmnt(6); end;
'T': begin
if atStmnt then (* ok to set breakpoint? *)
begin
setTBpt(cursorStack[cursor].st); (* put a temporary breakpoint there *)
runStmnt(6); (* & proceed with program *)
end
end;
'P': runStmnt(6); (* Proceed with program *)
'R': begin (* Run/Restart program *)
saveOutermostEnv; (* reset Interpreter *)
runStmnt(6); (* Start program from the top *)
end;
'X': begin (* Execute statement at current cursor location *)
if atStmnt then executeStmnt(cursorStack[cursor].st,6);
end;
otherwise begin
pp5(' huh?',5); ppOutNow;
okp := false;
end;
end;
end;
otherwise {do nothing - this shouldn't happen.. };
end
end (* eDoCmd *);